import download from '../utils/download'
import { loginRSA } from '/@/config'
import { md5Encode } from '/@/utils/encrypt'
import request from '/@/utils/request'


const CommonApi = {


  getIconList: (data: any) => {
    return request({
      url: '/common/getIconList',
      method: 'post',
      data,
    })
  },

  getNoticeList: () => {
    return request({
      url: '/common/getNoticeList',
      method: 'post',

    })
  },

  getPublicKey: () => {
    return request({
      url: '/common/getPublicKey',
      method: 'post',

    })
  },

  getEnumList: (params: any) => {
    return request({
      url: '/common/enum-list',
      method: 'get',
      params

    })
  },
  downloadAttachment:(url: any, name?: any) => {
      console.log("url",url)
      const item = url.split("/")
      const fileName = name ? name : item[item.length - 1]
      console.log("fileName：",fileName)
      axios({
          method: "get",
          url,
          responseType:"blob"
      }
      ).then(res=>{
          download(res,fileName)
      })
  },

  fileBatchUpload(data:any){
    return request({
      url: '/file/batchUpload',
      method: 'post',
      headersType: 'application/json;charset=UTF-8',
      data  
    })
  },
  getSysAgreement(params:any){
    return request({
      url: '/sysAgreement/detailByType',
      method: 'get',
      params
    })
  }

}

export default CommonApi;
